﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Sio.Mdm.Web.Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>SIO - MDM Prijava</title>
    <style type="text/css">
        .myClass
        {
            float: right;
            font-size: x-small;
        }
        .myClassLeft
        {
            float: left;
            font-size: x-small;
        }        
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager runat="server">
        <Listeners>
            <DocumentReady Handler="#{UserName}.focus(150);" />
        </Listeners>
    </ext:ResourceManager>
    <ext:Store runat="server" ID="StoreOrganizacije">
        <Reader>
            <ext:ArrayReader>
                <Fields>
                    <ext:RecordField Name="OrganizacijaId" Type="Int" />
                    <ext:RecordField Name="Naziv" Type="String" />
                </Fields>
            </ext:ArrayReader>
        </Reader>
    </ext:Store>
    <ext:Viewport runat="server" Layout="Fit">
        <Content>
            <ext:Panel runat="server" Layout="VBoxLayout">
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Center" Pack="Center" />
                </LayoutConfig>
                <Content>
                    <ext:FormPanel runat="server" ID="LoginForm" ButtonAlign="Right" Width="350" Title="Prijava"
                        Padding="10" LabelAlign="Right" MonitorPoll="500" MonitorValid="true" LabelWidth="60">
                        <Defaults>
                            <ext:Parameter Name="Anchor" Value="95%">
                            </ext:Parameter>
                            <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw">
                            </ext:Parameter>
                            <ext:Parameter Name="MsgTarget" Value="under">
                            </ext:Parameter>
                        </Defaults>
                        <Items>
                            <ext:TextField runat="server" ID="UserName" FieldLabel="Uporabnik" MinLengthText="6"
                                BlankText="Upoabniško ime je obvezno!">
                            </ext:TextField>
                            <ext:TextField runat="server" ID="Password" FieldLabel="Geslo" BlankText="Geslo je obvezno!"
                                InputType="Password">
                            </ext:TextField>
                            <ext:ComboBox runat="server" ID="Organizacija" StoreID="StoreOrganizacije" DisplayField="Naziv"
                                ValueField="OrganizacijaId" FieldLabel="Zavod">
                            </ext:ComboBox>
                            <ext:LinkButton ID="PozabljenogesloLBtn" runat="server" Text="Pozabljeno Geslo" Cls="myClass">
                                <Listeners>
                                    <Click Handler="#{WPozabljenoGeslo}.show();" />
                                </Listeners>
                            </ext:LinkButton>
                        <ext:LinkButton ID="Verzija" runat="server" Text="v 0.0.10.33" Cls="myClassLeft">
                                <Listeners>
                                    <Click Handler="window.open('http://194.249.18.26/mantisbt/');" />
                                </Listeners>
                            </ext:LinkButton>
                        </Items>
                        <Buttons>
                            <ext:Button runat="server" ID="LoginBtn" Text="Prijava" Icon="LockKey" Disabled="true">
                                <DirectEvents>
                                    <Click OnEvent="LoginClick" 
                                        Before="Ext.Msg.wait('Preverjanje...', 'Avtentikacija');"
                                        CleanRequest="true"
                                        Method="POST"
                                        Failure="Ext.Msg.show({
                                           title:   'Napaka pri prijavi',
                                           msg:     result.errorMessage,
                                           buttons: Ext.Msg.OK,
                                           icon:    Ext.MessageBox.ERROR
                                        });">
                                        <EventMask MinDelay="250" />
                                    </Click>
                                </DirectEvents>
                            </ext:Button>

                        </Buttons>
                        <Listeners>
                            <ClientValidation Handler="#{LoginBtn}.setDisabled(!valid);" />
                        </Listeners>
                        <KeyMap>
                            <ext:KeyBinding StopEvent="true">
                                <Keys>
                                    <ext:Key Code="ENTER" />
                                </Keys>
                                <Listeners>
                                    <Event Handler="if(!#{LoginBtn}.disabled) #{LoginBtn}.fireEvent('click');" />
                                </Listeners>
                            </ext:KeyBinding>
                        </KeyMap>
                        <Tools>
                            <ext:Tool Type="Help" Qtip="Potrebujete pomoč?" />
                        </Tools>
                    </ext:FormPanel>

                </Content>
            </ext:Panel>
        </Content>
    </ext:Viewport>
    <ext:Window ID="WPozabljenoGeslo" runat="server" Title="Pozabljeno geslo." Icon="PageWhitePut"
        Height="185px" Width="350px" BodyStyle="background-color: #fff;" Padding="5"
        Collapsible="false" Hidden="true" Modal="true">
        <Items>
            <ext:FormPanel ID="PozabljenoGesloPanel" runat="server" AutoHeight="true" Icon="Textfield"
                Closable="false" Padding="5" LabelWidth="100" AnchorHorizontal="95%" Layout="Form">
                <Defaults>
                    <ext:Parameter Name="Anchor" Value="95%">
                    </ext:Parameter>
                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw">
                    </ext:Parameter>
                    <ext:Parameter Name="MsgTarget" Value="under">
                    </ext:Parameter>
                </Defaults>
                <Items>
                    <ext:TextField ID="tfUporabniskoIme" runat="server" FieldLabel="Uporabniško ime"
                        MinLength="3" MsgTarget="Under" Width="155">
                    </ext:TextField>
                    <ext:TextField ID="tfEmail" runat="server" FieldLabel="E-pošta" DataIndex="email"
                        MsgTarget="Under" Width="155">
                    </ext:TextField>
                    <ext:ComboBox runat="server" ID="OrganizacijaPG" StoreID="StoreOrganizacije" DisplayField="Naziv"
                        ValueField="OrganizacijaId" FieldLabel="Zavod">
                    </ext:ComboBox>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons>
            <sio:Button runat="server" ID="PosljiBtn" Text="Pošlji" Icon="email">
                <DirectEvents>
                    <Click OnEvent="SendLogin">
                        <EventMask ShowMask="true" />
                    </Click>
                </DirectEvents>
            </sio:Button>
            <sio:Button runat="server" ID="ZapriBtn" Text="Zapri" Icon="Decline">
                <Listeners>
                    <Click Handler="#{WPozabljenoGeslo}.hide();" />
                </Listeners>
            </sio:Button>
        </Buttons>
    </ext:Window>
    <ext:Window ID="WPonastaviGeslo" runat="server" Title="Pozabljeno geslo." Icon="PageWhiteRefresh"
        Height="155px" Width="350px" BodyStyle="background-color: #fff;" Padding="5"
        Collapsible="false" Hidden="true" Modal="true">
        <Items>
            <ext:FormPanel ID="GesloPanel" runat="server" AutoHeight="true" Icon="Textfield"
                Closable="false" Padding="5" LabelWidth="100" AnchorHorizontal="95%" Layout="Form">
                <Items>
                    <ext:TextField ID="tfNovoGeslo" runat="server" FieldLabel="Novo geslo" MinLength="3"
                        InputType="Password" MsgTarget="Under" Width="155">
                    </ext:TextField>
                    <ext:TextField ID="tfPotrdiGeslo" runat="server" Vtype="password" FieldLabel="Potrdi geslo"
                        InputType="Password" MsgTarget="Under" Width="155">
                        <CustomConfig>
                            <ext:ConfigItem Name="initialPassField" Value="#{tfNovoGeslo}" Mode="Value" />
                        </CustomConfig>
                    </ext:TextField>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons>
            <sio:Button runat="server" ID="btnSpremeni" Text="Spremeni" Icon="accept">
                <DirectEvents>
                    <Click OnEvent="PonastaviGeslo">
                        <EventMask ShowMask="true" />
                    </Click>
                </DirectEvents>
            </sio:Button>
            <sio:Button runat="server" ID="btnZapri" Text="Zapri" Icon="Decline">
                <Listeners>
                    <Click Handler="#{WPonastaviGeslo}.hide();" />
                </Listeners>
            </sio:Button>
        </Buttons>
    </ext:Window>
    </form>
</body>
</html>
